package com.literature.search.core.entity.dto;

import com.literature.search.core.common.MessageConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

/**
 * @ClassName BasePageDTO
 * @Description TODO
 * @Author abin
 * @Date 2023/3/2 12:53
 * @Version 1.0
 */
@Data
@ApiModel(value = "分页查询条件")
public class BasePageDTO {

    /**
     * 页数
     */

    @ApiModelProperty(value = "页数", example = "1",notes = "默认为1")
    @NotNull(message = "page不能为空")
    @Min(value = 1, message = MessageConstant.PARAMS_FORMAT_ERROR)
    protected Integer page = 1;

    /**
     * 每页条数
     */
    @ApiModelProperty(value = "每页条数", example = "10",notes = "默认为10")
    @NotNull(message = "rows不能为空")
    @Min(value = 1, message = MessageConstant.PARAMS_FORMAT_ERROR)
    @Max(value = 100, message = MessageConstant.PARAMS_FORMAT_ERROR)
    protected Integer rows;
}
